package com.love.netty.core.interfaces.impl;

import com.love.netty.core.interfaces.ConsoleCommand;
import com.love.netty.core.packet.request.MessageRequestPacket;
import io.netty.channel.Channel;

import java.util.Scanner;

/**
 * @ClassName: SendToUserConsoleCommand
 * @Description:
 * @Author: wuj
 * @Date: 2021-06-25 11:02
 **/
public class SendToUserConsoleCommand implements ConsoleCommand {
    @Override
    public void exec(Scanner scanner, Channel channel) {
        System.out.print("发送消息给某个某个用户：");

        String toUserId = scanner.next();
        String message = scanner.next();
        channel.writeAndFlush(new MessageRequestPacket(toUserId, message));
    }
}
